var newsContainer = Vue.extend({

data(){
  return{
  	rightShow:true,
  	detailShow:false,
  	newsdDet:'/news',
  };
},
created(){

},
mounted: function() {
    this.$nextTick(function() {
    this.detAddress();
    });
},
methods: {
	detAddress(){  //判断右则和详细页是否显示
		var reg = /\/newsDetail\/(\d+)\/(\d+)/;
		var detAddress = this.$route.path.match(reg)[2];
		//console.log(detAddress);
		if (detAddress) {
		  	this.rightShow=false;
		  	this.detailShow=true;
		};
	}
},
watch:{
  $route(to,from){
    console.log(to.path,from.path);
    //console.log(from.path);
    console.log(this.newsdDet.indexOf(to.path));
    if (this.newsdDet.indexOf(to.path) == 0) {
	  	this.rightShow=true;
	  	this.detailShow=false;
    } else if (this.newsdDet.indexOf(to.path) == -1) {
	  	this.rightShow=false;
	  	this.detailShow=true;
    };
  }
},
components:{
	newsLeft,
	newsRight,
	newsDetail
},
props: ['newsData'],
template:'\
<div>\
	<section class="banner">\
	    <div>\
	        <img src="images/news_banner.jpg" alt=""></div>\
	</section>\
	<div class="com_zi clearfix">\
	    <news-left></news-left>\
	    <news-right v-bind:news-list="newsData" v-show="rightShow"></news-right>\
	    <router-view v-bind:news-det="newsData" v-show="detailShow"></router-view>\
	</div>\
</div>\
',

});